package cn.edu.sxw.web.server.service;

import com.baidu.aip.face.AipFace;
import org.json.JSONObject;

import java.util.HashMap;

public class BaiduAiService {
    public JSONObject checkFaces(String imageBase64){
        //百度ai实例化
        AipFace client = new AipFace("***","***","***");
        //传入可选参数调用接口
        HashMap options = new HashMap();
        options.put("face_field","age,beauty,expression,face_shape,gender,glasses,landmark,landmark72,landmark150,quality,eye_status,emotion,face_type");
        options.put("max_face_num", "10");
        options.put("face_type", "LIVE");
        options.put("liveness_control", "NONE");

        String imageType = "BASE64";

        //人脸检测
        JSONObject res = client.detect(imageBase64,imageType,options);
        return res;
    }
}
